// 调用此接口 , 传入歌手 id, 可获得歌手描述
export let artist_desc = {
  namespaced: true,
  state: {
    artist_desc_data: {},
    artist_detail_data: {}
  },
  actions: {
    getArtistDesc(store, data = {}) {
      let url = "/artist/desc?id=" + data.id;
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit('setArtistDesc', data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            reject(error.response.data);
          }
        });
      });
    },
    getArtistDetail(store, data = {}) {
      let url = "/user/detail?uid=" + data.uid;
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit('setArtistDetail', data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            reject(error.response.data);
          }
        });
      });
    }
  },
  mutations: {
    setArtistDesc(state, data) {
      state.artist_desc_data = data;
    },
    setArtistDetail(state, data) {
      state.artist_detail_data = data;
    }
  }
}
